<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateProvinceTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('sys_province', function (Blueprint $table) {
            $table->increments('id')->unsigned()->comment('地址--省表');
            $table->string('name')->comment('省份名');
            $table->engine = 'MyISam';
        });

        Schema::create('sys_city', function (Blueprint $table) {
            $table->increments('id')->unsigned()->comment('地址--城市表');
            $table->integer('province_id')->comment('省份id');
            $table->string('name')->comment('城市名');
            $table->string('city_no')->nullable()->comment('区号');
            $table->string('full_spell')->nullable()->comment('全拼');
            $table->string('first_spell')->nullable()->comment('简拼');
            $table->engine = 'MyISam';
        });

        Schema::create('sys_district', function (Blueprint $table) {
            $table->increments('id')->unsigned()->comment('地址--区县表');
            $table->string('name');
            $table->integer('city_id');
            $table->string('post_code')->nullable()->comment('邮编');
            $table->engine = 'MyISam';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('sys_province');
        Schema::dropIfExists('sys_city');
        Schema::dropIfExists('sys_district');
    }
}
